<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link href="/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
	<link href="/assets/css/app.min.css" rel="stylesheet" type="text/css" />
	<link href="/assets/element/index.css" rel="stylesheet">
	<link href="/assets/css/base.css" rel="stylesheet">
	<script src="/assets/element/vue.js"></script>
	<script src="/assets/element/index.js"></script>
	<script src="/assets/js/axios.min.js"></script>
	<script src="/components/base.component.js"></script>
	<script src="/assets/libs/jquery/jquery.min.js"></script>
	<script src="/assets/libs/metismenu/metisMenu.min.js"></script>
	<script src="/assets/js/js.cookie.min.js"></script>
	<script src="/assets/js/common.js"></script>

		<script type="text/javascript">
		const base_url = '/lvguApi';
		const base_dir = '';//勿要删除
		const ip = '27.193.4.221';
		const user_info = {
			username: "admin",
			role_id: "1",
		}
	</script>
</head>


<body>
	<header id="page-topbar" style="position:fixed;left:0; top:0; z-index:999;">
		<div class="navbar-header">
			<div class="d-flex">
				<div class="navbar-header">
					<div class="d-flex" data-toggle="cospan">
						<i style="margin-left:15px;" id="vertical-menu-btn" class="el-icon-s-fold"></i>
						<i style="margin-left:15px;" @click="reload" class="el-icon-refresh hidden-sm-and-down"></i>
					</div>

					<div class="d-flex hidden-sm-and-down">
						<el-breadcrumb separator="/" style="margin-left:30px;">
							<el-breadcrumb-item v-for="item in levelList" :key="item.path">
								<a v-if="item.title == '首页'" :href="item.path">{{item.title}}</a>
								<span v-else>{{item.title}}</span>
							</el-breadcrumb-item>
						</el-breadcrumb>
					</div>
				</div>
			</div>
			<div class="d-flex"
				style="flex: 1; padding-left: 30px;; text-align: center;font-size:15px;color:red;font-weight:bold;">
			</div>
			<div class="d-flex">
				<div class="iconbutton">
					<el-tooltip content="清除缓存" effect="dark" placement="bottom">
						<i @click="clearCache()" class="icontool el-icon-delete"></i>
					</el-tooltip>
				</div>
								<div class="iconbutton hidden-sm-and-down">
					<el-badge :value="3" is-dot>
						<el-dropdown placement="bottom-start" @click.native="getNotice" trigger="click">
							<i class="icontool el-icon-bell" style="font-size:140%"></i>
							<el-dropdown-menu slot="dropdown">
								<div style="width:250px; height:200px; padding:10px 0; text-indent:10px;">
									<ul>
										<li v-for="item in notice">
											<a :href="item.url">
												<svg
													style="width: 1.2em;height: 1.2em;vertical-align: -0.25em;fill: currentColor;overflow: hidden;"
													id="el-icon-alidaichuli" viewBox="0 0 1024 1024">
													<path
														d="M704.2048 935.8848H246.7328c-73.5232 0-133.12-59.5968-133.12-133.12V217.4976c0-73.5232 59.5968-133.12 133.12-133.12h457.472c73.5232 0 133.12 59.5968 133.12 133.12v585.2672c0 73.5232-59.5968 133.12-133.12 133.12z"
														fill="#FFAC3E"></path>
													<path
														d="M639.4368 326.0416H314.368c-22.6304 0-40.96-18.3296-40.96-40.96s18.3296-40.96 40.96-40.96h325.12c22.6304 0 40.96 18.3296 40.96 40.96s-18.3808 40.96-41.0112 40.96zM639.4368 488.448H314.368c-22.6304 0-40.96-18.3296-40.96-40.96s18.3296-40.96 40.96-40.96h325.12c22.6304 0 40.96 18.3296 40.96 40.96s-18.3808 40.96-41.0112 40.96zM470.016 650.8544H314.368c-22.6304 0-40.96-18.3296-40.96-40.96s18.3296-40.96 40.96-40.96h155.648c22.6304 0 40.96 18.3296 40.96 40.96s-18.3296 40.96-40.96 40.96z"
														fill="#FFFFFF"></path>
													<path
														d="M750.2336 743.1168m-189.952 0a189.952 189.952 0 1 0 379.904 0 189.952 189.952 0 1 0-379.904 0Z"
														fill="#FFAC3E"></path>
													<path
														d="M750.2336 552.8064c-104.9088 0-189.952 85.0432-189.952 189.952 0 99.9936 77.2608 181.8624 175.36 189.3376 58.368-14.08 101.7856-66.6624 101.7856-129.3824V573.952a190.21312 190.21312 0 0 0-87.1936-21.1456z"
														fill="#FF7C0E"></path>
													<path
														d="M645.7856 743.1168m-35.9936 0a35.9936 35.9936 0 1 0 71.9872 0 35.9936 35.9936 0 1 0-71.9872 0Z"
														fill="#FFFFFF"></path>
													<path
														d="M750.6432 743.1168m-35.9936 0a35.9936 35.9936 0 1 0 71.9872 0 35.9936 35.9936 0 1 0-71.9872 0Z"
														fill="#FFFFFF"></path>
													<path
														d="M855.5008 743.1168m-35.9936 0a35.9936 35.9936 0 1 0 71.9872 0 35.9936 35.9936 0 1 0-71.9872 0Z"
														fill="#FFFFFF"></path>
												</svg>
												您有<i>{{item.num}}</i> {{item.title}}
											</a>
										</li>
									</ul>
								</div>
							</el-dropdown-menu>
						</el-dropdown>
					</el-badge>
				</div>
				
				<div class="iconbutton">
					<el-avatar src="/static/img/logo.png" style="vertical-align:middle"></el-avatar>
					<el-dropdown trigger="click" placement="bottom" style="cursor: pointer;margin-right:15px;">
						<span class="el-dropdown-link">
							<i style="margin-left:0px; font-size:100%"
								class="icontool el-icon-arrow-down"></i>
						</span>
						<el-dropdown-menu slot="dropdown">
							<el-dropdown-item icon="el-icon-lock"
								@click.native.prevent="passwordDialogStatus = true">修改密码</el-dropdown-item>
							<el-dropdown-item icon="el-icon-back" @click.native.prevent="logout">退出</el-dropdown-item>
						</el-dropdown-menu>
					</el-dropdown>
				</div>
				<div class="iconbutton" style="margin-left:0">
					<i class="bx bx-cog bx-spin right-bar-toggle"></i>
				</div>
			</div>
		</div>

		<el-dialog title="重置密码" style="margin-top:100px;" width="450px" :visible="passwordDialogStatus"
			:before-close="closeForm" append-to-body>
			<el-form :size="size" ref="form" :model="form" :rules="rules" label-width="80px">
				<el-row>
					<el-col :span="24">
						<el-form-item label="新密码" prop="password">
							<el-input show-password autoComplete="off" v-model="form.password" clearable placeholder="请输入密码" />
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-form-item label="确认密码" prop="repassword">
							<el-input show-password autoComplete="off" v-model="form.repassword" clearable placeholder="请输入确认密码" />
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button :size="size" :loading="loading" type="primary" @click="submit">
					<span v-if="!loading">确 定</span>
					<span v-else>提 交 中...</span>
				</el-button>
				<el-button :size="size" @click="closeForm">取 消</el-button>
			</div>
		</el-dialog>
	</header>

	<script>
		new Vue({
			el: '#page-topbar',
			data() {
				var validatePass2 = (rule, value, callback) => {
					if (value === '') {
						callback(new Error('请再次输入密码'))
					} else if (value !== this.form.password) {
						callback(new Error('两次输入密码不一致!'))
					} else {
						callback()
					}
				}
				return {
					form: {
						password: '',
						repassword: '',
					},
					url: {},
					levelList: [],
					notice: [],
					passwordDialogStatus: false,
					loading: false,
					size: 'small',
					urlobj: {},//这里是判断如果是弹窗链接的话 不显示头部
					rules: {
						password: [{ required: true, message: '密码不能为空', trigger: 'blur' }],
						repassword: [
							{ required: true, validator: validatePass2, trigger: 'blur' },
						],
					}
				}
			},
			mounted() {
				if (sessionStorage.getItem(base_url + 'breadcrumb')) {
					const menuList = JSON.parse(sessionStorage.getItem(base_url + 'breadcrumb'))
					this.url = new URL(window.location.href)
					let menus = this.getMenus(menuList)
					let home = [{ title: '首页', path: base_url + '/Index/main.html' }]
					if (menus !== undefined) {
						if (this.url.pathname !== base_url + '/Index/main.html' && this.url.href !== base_url + '/Index/main.html') {
							menus = home.concat(menus)
						}
					} else {
						menus = home
					}

					this.levelList = menus
				}
			},
			methods: {
				getMenus(menuList, arr, z) {
					arr = arr || []
					z = z || 0
					for (let i = 0; i < menuList.length; i++) {
						let item = menuList[i]
						arr[z] = item
						if (this.url.pathname === menuList[i].url || this.url.href === menuList[i].url) {
							return arr.slice(0, z + 1)
						}
						if (menuList[i].children && menuList[i].children.length) {
							let res = this.getMenus(menuList[i].children, arr, z + 1)
							if (res) {
								return res
							}
						}
					}
				},
				submit() {
					this.$refs['form'].validate(valid => {
						if (valid) {
							this.loading = true
							axios.post(base_url + '/Base/resetPwd', this.form).then(res => {
								if (res.data.status == 200) {
									this.$message({ message: '操作成功', type: 'success' })
									this.closeForm()
								} else {
									this.$message.error('修改失败')
								}
							}).catch(() => {
								this.loading = false
							})
						}
					})
				},
				closeForm() {
					this.passwordDialogStatus = false
					this.loading = false
					if (this.$refs['form'] !== undefined) {
						this.$refs['form'].resetFields()
					}
				},
				getNotice() {
					axios.post(base_url + '/Index/getNotice').then(res => {
						if (res.data.status == 200) {
							this.notice = res.data.data
						}
					})
				},
				clearCache() {
					this.$confirm('确定清除缓存吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						axios.post(base_url + '/Base/clearCache').then(res => {
							if (res.data.status == 200) {
								this.$message({ message: '操作成功', type: 'success' })
							}
						})
					})
				},
				logout() {
					this.$confirm('确定注销并且退出系统?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						axios.get(base_url + '/Login/logout').then(res => {
							if (res.data.status == 200) {
								sessionStorage.setItem(base_url + 'breadcrumb', '')
								Cookies.set(base_url + 'menu', '')
								top.parent.frames.location.href = base_url + '/login/index'
							}
						})
					})
				},
				reload() {
					location.reload()
				},
			},
		})
	</script>

	<div id="app" class="page-content" :style="!urlobj.dialogstate ? 'margin-top:60px;':'margin-top:10px;'">
    
<div style="margin:0 15px 15px 15px;">
  <el-card shadow="never" style="min-height:650px;">
    <div v-if="search_visible" id="search" class="search">
      <el-form ref="form" size="small" :model="searchData" inline>

        <el-form-item label="姓名">
          <el-input v-model="searchData.姓名" style="width:100px;" clearable></el-input>
        </el-form-item>
        <el-form-item label="手机号">
          <el-input v-model="searchData.手机号" style="width:160px;" clearable></el-input>
        </el-form-item>
        
      </el-form>
    </div>

    <el-table :row-class-name="rowClass" @selection-change="selection" @row-click="handleRowClick" row-key="id"
      :header-cell-style="{ background: '#eef1f6', color: '#606266' }" v-loading="loading" ref="multipleTable" border
      class="eltable" :data="list" style="width: 100%">
	    <el-table-column align="center" type="selection" width="42"></el-table-column>
      <el-table-column align="center" property="user" label="姓名" show-overflow-tooltip width="120">
        <template slot-scope="{row}">
          <div > {{row.user}} </div>
        </template>
      </el-table-column>
      <el-table-column align="left" property="user" label="姓名" show-overflow-tooltip min-width="70">
        <template slot-scope="{row}">
          <div v-if="row.farmers"> 
            金币：{{row.coins}}，
            土地：{{row.lands.length}}，
            种子：{{row.seeds.length}}，
            农民：{{row.farmers.length}}，
            </div>
          <div>
          <el-button size="mini" @click="getAccountInfo(row)">获取账号信息</el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- <Page :total="page_data.total" :page.sync="page_data.page" :limit.sync="page_data.limit" @pagination="index" /> -->
  </el-card>
</div>

	</div>

 
	
<script src="/assets/js/app.js"></script>
<script src="/assets/libs/treeselect/vue-treeselect.umd.min.js"></script>
<link rel="stylesheet" href="/assets/libs/treeselect/vue-treeselect.min.css">
<script src="/assets/libs/vuedragable/Sortable.min.js"></script>
<script src="/assets/libs/vuedragable/vuedraggable.umd.min.js"></script>
<script type="text/javascript" src="/static/layer-v3.5.1/layer.js"></script>

<script>
  new Vue({
    el: '#app',
    components: {
      'treeselect': VueTreeselect.Treeselect,
      'draggable': window.vuedraggable,
    },
    data: function () {
      return {
        drawer_show: false,
        opt_row:{},
        dialog: {
          heshiDialogStatus: false,
          updateDialogStatus: false,
          detailDialogStatus: false,
          zbQianshouDialogStatus: false,
          fujianIptDlgStatus: false,
        },
        searchData: {
          // area_name: '', plate_is_null: false
        },
        button_group: [{
          name: '添加',
          color: 'success',
          access: '/admin/Device/add.html',
          icon: 'el-icon-plus',
          disabled: '',
          clickname: 'add'
        },
        {
          name: '修改',
          color: 'primary',
          access: '/admin/Device/update.html',
          icon: 'el-icon-edit',
          disabled: 'single',
          clickname: 'update'
        },
        {
          name: '删除',
          color: 'danger',
          access: '/admin/Device/delete.html',
          icon: 'el-icon-delete',
          disabled: 'multiple',
          clickname: 'del'
        },
        {
          name: '查看详情',
          color: 'info',
          access: '/admin/Device/detail.html',
          icon: 'el-icon-view',
          disabled: 'single',
          clickname: 'detail'
        },
        ],
        loading: false,
        page_data: {
          limit: 20,
          page: 1,
          total: 20,
        },
        ids: [],
        single: true,
        multiple: true,
        search_visible: true,
        list: [],
        class_id: [],
        supplier_id: [],
        updateInfo: {},
        detailInfo: {},
        device_type_arr: [],
        kakou_name_arr: [], 
      }
    },
    methods: {
      loadData() {
        this.index()
      },
      index() {
        let param = {
          limit: this.page_data.limit,
          page: this.page_data.page
        }
        Object.assign(param, this.searchData)
        this.loading = true

        axios.post(base_url + '/account/list', param).then(res => {
          console.log(res.data)
          if (res.data.status == 200) {
            this.list = res.data.data
            this.page_data.total = res.data.total
            this.loading = false
          } else {
            this.$message.error(res.data.msg);
          }
        })
      },
      getAccountInfo(row) {
        axios.post(base_url + '/account/GetAccountInfo', {
          user:row.user,password:row.password
        }).then(res => {
          this.$set(row, "coins", res.data.coins )
          this.$set(row, "farmers", res.data.farmers )
          this.$set(row, "lands", res.data.lands )
          this.$set(row, "seeds", res.data.seeds )
        })
      },
      selection(selection) {
        this.ids = selection.map(item => item.id)
        this.single = selection.length != 1
        this.multiple = !selection.length
      },
      handleRowClick(row, rowIndex, event) {
        if (event.target.className !== 'el-input__inner') {
          this.$refs.multipleTable.toggleRowSelection(row)
        }
      },
      rowClass({
        row,
        rowIndex
      }) {
        for (let i = 0; i < this.ids.length; i++) {
          if (row.id === this.ids[i]) {
            return 'rowLight'
          }
        }
      },
      normalizer(node) {
        if (node.children && !node.children.length) {
          delete node.children
        }
        return {
          id: node.val,
          label: node.key,
          children: node.children
        }
      },
      fn(method) {
        this[method](this.ids)
      },
    },
    mounted() {
      this.index()
    },
  })
</script>
	
	<script type="text/javascript" src="/static/layer-v3.5.1/layer.js"></script>
	<style>
		#sidebar-menu ul li ul.sub-menu li a {
			padding: 0;
			font-size: 12px;
			color: red;
		}
	</style>
</body>

</html>